package com.jiantong.user.impl.dao;

import com.jiantong.user.model.GovernmentUserDuty;
import io.terminus.common.mysql.dao.MyBatisDao;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * Created by niufei on 2017/4/6.
 *
 */
@Repository
public class GovernmentUserDutyDao extends MyBatisDao<GovernmentUserDuty>{

    /**
     * 根据userId 查询 关联的list
     * @param criteria 用户id 和 状态
     * @return List<GovernmentUserDuty>
     */
    public List<GovernmentUserDuty> findGovernmentUserDutiesByUserId(Map<String ,Object> criteria){
        return getSqlSession().selectList(sqlId("findGovernmentUserDutiesByUserId"),criteria);
    }

    /**
     * 根据用户id 删除相关记录
     * @param userId 用户id
     * @return int
     */
    public int deleteByUserId(Long userId){
        return getSqlSession().delete(sqlId("deleteByUserId"),userId);
    }
}
